######################################
# LSPCI 测试
######################################

cat /proc/bus/pci/devices

lspci | cut -d: -f1-2
cat /proc/bus/pci/devices | cut -f1
tree /sys/bus/pci/devices/

file /proc/bus/pci/00/04.0
cat /proc/bus/pci/00/04.0 | od -Ax -t x1

ll /sys/bus/pci/devices
ll /sys/bus/pci/devices/0000\:00\:04.0/

file /sys/bus/pci/devices/0000\:00\:04.0/config
cat  /sys/bus/pci/devices/0000\:00\:04.0/config | od -Ax -t x1

cat  /sys/bus/pci/devices/0000\:00\:04.0/vendor
cat  /sys/bus/pci/devices/0000\:00\:04.0/device
cat  /sys/bus/pci/devices/0000\:00\:04.0/subsystem_device
cat  /sys/bus/pci/devices/0000\:00\:04.0/subsystem_vendor
cat  /sys/bus/pci/devices/0000\:00\:04.0/class
cat  /sys/bus/pci/devices/0000\:00\:04.0/irq
cat  /sys/bus/pci/devices/0000\:00\:04.0/resource
cat  /sys/bus/pci/devices/0000\:00\:04.0/msi_irqs/26
cat  /sys/bus/pci/devices/0000\:00\:04.0/msi_irqs/27
cat  /sys/bus/pci/devices/0000\:00\:04.0/msi_irqs/28

ll /sys/bus/pci/drivers/

ll /proc/ioports
sudo cat /proc/ioports

######################################
# pci_skel 模块测试
######################################

sudo dmesg -c
lspci -s 00:04.0 -vvv

ll /sys/bus/pci/drivers/virtio-pci/
# 必须切换到 root 用户
echo "0000:00:04.0" > /sys/bus/pci/drivers/virtio-pci/unbind 

sudo dmesg -c
sudo lspci -s 00:04.0 -vvv

sudo insmod ./pci_skel.ko
sudo lspci -s 00:04.0 -vvv
sudo dmesg -c
cat  /sys/bus/pci/devices/0000\:00\:04.0/irq

sudo rmmod ./pci_skel.ko
sudo dmesg -c


